package com.kpx.app.utils;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import java.lang.ref.WeakReference;

/**
 * 可以避免内存泄露的Handler
 * @author Scott Smith  @Date 2016年04月16/4/28日 15:56
 */
public class HandlerManager extends Handler {
    private WeakReference<AppCompatActivity> reference;
    public HandlerManager(AppCompatActivity activity) {
        reference = new WeakReference<>(activity);
    }
    public AppCompatActivity getActivity() {
        return reference.get();
    }
}
